<script setup lang='ts'>
  import { computed, inject } from 'vue';
  import { getItem } from '@/utils/storage'
  // import { addlimit, reducelimit } from '@/hook/imgload';
  const props = defineProps({
    src:{
      type:String,
      default:''
    },
  })
  const imgurl = computed(()=>{
    const { src } = props
    if (src.indexOf('http') == -1 && src.indexOf('https') == -1) {
      return getAssetsFile(src)
    }
    return props.src
  })
  const getAssetsFile = (url: string,name='' as string)=>{
    const href = `./images/${getItem('custom_id')}/${url}`
    // const href = new URL(`../../public/images/theme1/${url}`, import.meta.url).href
    return href
  }
  // const FunName = inject('onLoadFunName') as string
  // addlimit(FunName)
  // const Load = ()=>{
  //   reducelimit(FunName)
  // }
  // const error = ()=>{
  //   reducelimit(FunName)
  // }
</script>

<template>
  <img :src="imgurl" >
</template>